
import count from '@dfeidao/atom-nodejs/db/count';
import query from '@dfeidao/atom-nodejs/db/query';
import { IncomingHttpHeaders } from 'http';
import { productid, systemid } from '../../atom/config';

interface Message {
	filter: {
		meeting_nos: string[],
		pn: number
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}
export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const p = query(action_id, session_id, systemid);
	p.prepare('meeting_administration', ['meeting_no', 'meeting_name', 'start_time', 'conference_theme', 'meeting_status',
		'sponsor', 'meeting_address'], { productid, sponso_no: message.filter.meeting_nos }, 20, message.filter.pn, ['start_time'], ['2']);
	// 1是升序 2是降序
	const [dt] = await p.exec();
	const t = count(action_id, session_id, systemid);
	t.prepare('meeting_administration', { productid, sponso_no: message.filter.meeting_nos });
	const c = await t.exec();
	return { dt, c };
}
